package com.fly.demo.web.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fly.demo.web.entity.LoginResult;

@RestController
@RequestMapping("/user")
public class UserController
{
    LoginResult loginResult = new LoginResult();
    
    /**
     * 用户查询.
     * 
     * @return
     */
    @GetMapping(value = "/userList")
    @RequiresPermissions("user:view") // 权限管理;
    public LoginResult userInfo()
    {
        loginResult.setLogin(true);
        loginResult.setResult("用户查询");
        return loginResult;
    }
    
    /**
     * 用户添加;
     * 
     * @return
     */
    @RequestMapping("/userAdd")
    @RequiresPermissions("user:add") // 权限管理;
    public LoginResult userInfoAdd()
    {
        loginResult.setLogin(true);
        loginResult.setResult("用户添加");
        return loginResult;
    }
    
    /**
     * 用户删除;
     * 
     * @return
     */
    @RequestMapping("/userDel")
    @RequiresPermissions("user:del") // 权限管理;
    public LoginResult userDel()
    {
        loginResult.setLogin(true);
        loginResult.setResult("用户删除");
        return loginResult;
    }
}